/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action.request;

import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import database.ProductDAO;
import java.util.Map;
import model.Product;
import model.Staff;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;

/**
 *
 * @author Trang
 */
@Namespace("/Administration/Request")
public class RequestReceiptAction extends ActionSupport{
    
    private Integer pid; 
    private Product product;
    private Staff staff;

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Staff getStaff() {
        return staff;
    }

    public void setStaff(Staff staff) {
        this.staff = staff;
    }
    
    
    @Action(value = "request-receipt-page/*", results = {
        @Result(name = "success", location = "/manageRequest/w_requestReceipt.jsp")},
            params = {"pid", "{1}"})
    //@SkipValidation
    public String editProfileForm() {
        //System.out.println(rid);
        Map session = ActionContext.getContext().getSession();
        staff = (Staff) session.get("staff"); 
        product = new ProductDAO().getProductShortFromProductId(pid);
        session.put("RequestProduct", product);
        //session.put("request", request);
        //System.out.println(request.getStaff1().getFirstname());
        return SUCCESS;
    }
}
